# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.CivicInfo.V2.Model.CivicinfoSchemaV2Candidate do
  @moduledoc """
  Information about a candidate running for elected office.

  ## Attributes

  *   `candidateUrl` (*type:* `String.t`, *default:* `nil`) - The URL for the candidate's campaign web site.
  *   `channels` (*type:* `list(GoogleApi.CivicInfo.V2.Model.CivicinfoSchemaV2Channel.t)`, *default:* `nil`) - A list of known (social) media channels for this candidate.
  *   `email` (*type:* `String.t`, *default:* `nil`) - The email address for the candidate's campaign.
  *   `name` (*type:* `String.t`, *default:* `nil`) - The candidate's name. If this is a joint ticket it will indicate the name of the candidate at the top of a ticket followed by a / and that name of candidate at the bottom of the ticket. e.g. "Mitt Romney / Paul Ryan"
  *   `orderOnBallot` (*type:* `String.t`, *default:* `nil`) - The order the candidate appears on the ballot for this contest.
  *   `party` (*type:* `String.t`, *default:* `nil`) - The full name of the party the candidate is a member of.
  *   `phone` (*type:* `String.t`, *default:* `nil`) - The voice phone number for the candidate's campaign office.
  *   `photoUrl` (*type:* `String.t`, *default:* `nil`) - A URL for a photo of the candidate.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :candidateUrl => String.t() | nil,
          :channels => list(GoogleApi.CivicInfo.V2.Model.CivicinfoSchemaV2Channel.t()) | nil,
          :email => String.t() | nil,
          :name => String.t() | nil,
          :orderOnBallot => String.t() | nil,
          :party => String.t() | nil,
          :phone => String.t() | nil,
          :photoUrl => String.t() | nil
        }

  field(:candidateUrl)
  field(:channels, as: GoogleApi.CivicInfo.V2.Model.CivicinfoSchemaV2Channel, type: :list)
  field(:email)
  field(:name)
  field(:orderOnBallot)
  field(:party)
  field(:phone)
  field(:photoUrl)
end

defimpl Poison.Decoder, for: GoogleApi.CivicInfo.V2.Model.CivicinfoSchemaV2Candidate do
  def decode(value, options) do
    GoogleApi.CivicInfo.V2.Model.CivicinfoSchemaV2Candidate.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.CivicInfo.V2.Model.CivicinfoSchemaV2Candidate do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
